import React, { useState } from 'react';

import { Button } from 'dw-mx';
import { Modal } from 'dw-mx';
import { ExclamationCircleOutlined } from 'dw-mx-icons';

export default function Basic() {
    const [modal, updateModal] = useState({
        open: false,
        props: {},
    });

    const toggleModal = async (open, props = {}) => {
        updateModal({
            open,
            props,
        });
    };

    return (
        <div>
            {modal.open && (
                <Modal title="人员信息" visible={true} onOk={() => toggleModal(false)} onCancel={() => toggleModal(false)}>
                    Hello World!
                </Modal>
            )}

            <Button
                onClick={() =>
                    toggleModal(true, {
                        xm: '小明',
                        age: 18,
                    })
                }
            >
                弹出
            </Button>
        </div>
    );
}
